/*
 * @Author: 杜兜兜
 * @Date: 2025-03-19 21:44:30
 * @LastEditTime: 2025-03-27 13:21:48
 * @motto: Still water run deep
 * @Description: Modify here please
 * @FilePath: \hici_cloud_web\src\api\mes\wm\productsalse.js
 */
import request from "@/utils/request";

// 查询销售出库单列表
export function listProductsalse(query) {
  return request({
    url: "/mes/wm/productsalse/list",
    method: "get",
    params: query,
  });
}

export function listProductsalseLine(query) {
  return request({
    url: "/mes/wm/productsalseline/line/list",
    method: "get",
    params: query,
  });
}

// 查询销售出库单详细
export function getProductsalse(salseId) {
  return request({
    url: "/mes/wm/productsalse/" + salseId,
    method: "get",
  });
}

// 新增销售出库单
export function addProductsalse(data) {
  return request({
    url: "/mes/wm/productsalse",
    method: "post",
    data: data,
  });
}

// 修改销售出库单
// export function updateProductsalse(data) {
//   return request({
//     url: '/mes/wm/productsalse',
//     method: 'put',
//     data: data
//   })
// }
// 修改销售出库单
export function updateProductsalse(data) {
  return request({
    url: "/mes/wm/productsalse/updateInfo",
    method: "post",
    data: data,
  });
}
// 删除销售出库单
export function delProductsalse(salseId) {
  return request({
    url: "/mes/wm/productsalse/" + salseId,
    method: "delete",
  });
}

//执行出库
export function execute(salseId) {
  return request({
    url: "/mes/wm/productsalse/" + salseId,
    method: "put",
  });
}

// 根据发货单生成销售退货单
export function addSale(data) {
  return request({
    url: "/mes/wm/productsalse/addSale",
    method: "post",
    data: data,
  });
}
//erp回写

export function saveToErp(salseId) {
  return request({
    url: "/mes/k3cloud/api/outStockData/saveToErp/" + salseId,
    method: "get",
  });
}
